<template>
  <div>
    <BasicTable @register="registerTable" >
    </BasicTable>
    <FormDetail @register="registerFormDetail"/>
  </div>
</template>
<script lang="ts" name="EvbNotifyRecord" setup>
import { ref } from 'vue';
import { Auth } from '/@/enums/authEnum'
import { BasicTable, BasicColumn, useTable } from '/@/components/Table';
import { useDrawer } from '/@/components/Drawer';
import { useI18n } from '/@/hooks/web/useI18n';
import { usePermission } from '/@/hooks/web/usePermission';
import { useGlobSetting } from '/@/hooks/setting';
import { columns, searchFormSchema } from './data';
import * as evbApi from '/@/api/infra/eventBus';
import { useMessage } from '/@/hooks/web/useMessage';
import FormDetail from './Detail.vue';
import { useRouter } from "vue-router"
import { Icon } from '/@/components/Icon';

const { t } = useI18n('');
const { createMessage } = useMessage();
const glob = useGlobSetting();
const { isDisabledAuth } = usePermission()
const [registerFormDetail, { openDrawer: openFormDetail }] = useDrawer()

const actionColumn: BasicColumn = {
  width: 130,
  title: '操作',
  dataIndex: 'action',
  fixed: 'right',
  slot: 'tableActions',
  actions:  (record: Recordable) => [
    {
      label: '详情',
      onClick: handleDetail.bind(null, record),
    },
  ],
  dropDownActions: (record: Recordable) => [
    
  ]
}

const [registerTable, { reload, expandAll, collapseAll, expandCollapse }] = useTable({
  title: '通知记录',
  api: evbApi.pageNotifyRecord,
  columns: columns,
  bordered: false,
  beforeFetch: (params) => {
    return params;
  },
  formConfig: {
    baseColProps: { lg: 6, md: 12 },
    wrapperCol: { lg: 24, md: 24 },
    labelWidth: 90,
    schemas: searchFormSchema,
    showResetButton: false,
  },
  showTableSetting: true,
  showIndexColumn: false,
  useSearchForm: true,
  pagination: true,
  canResize: true,
  rowKey: 'id',
  actionColumn,
})

const handleDetail = (record) => openFormDetail(true, { record })
const handleSuccess = () => reload()

</script>
